<template>
	<view class="zhgl">
		<headertop str1="oridei" title="账号管理"></headertop>
		<view class="zhglbaqck'">

		</view>
		<view class="zhanghubox">
			<view class="msgicon" v-if="!list.length">
				<image src="https://shop.hacuu.com/static/Frame@2x(21).png" mode="widthFix"></image>
				<view class="msgtext">
					暂无内容
				</view>
			</view>

			<view class="itemzh" v-for="(item,index) in list" @click="gopage(item)" :key="item.id">
				<view class="yinhanginfo">
					<view class="texts">
						<view class="t1">
							{{item.account_header}}
							<image src="http://shop.hacuu.com/static/Group 1604@2x.png" v-if="item.is_default==1"
								class="mobox" mode="" />
						</view>
					</view>
				</view>
				<view class="kahao">
					**** **** **** {{item.account_no.slice(-4)}}
				</view>
			</view>


		</view>
		<view class="" style="height: 188rpx;">

		</view>
		<view class="fixed">
			<view class="fixedbtn" @click="bankopage">
				添加账户
			</view>
		</view>
	</view>
</template>

<script setup>
	import headertop from '@/components/header.vue'
	import {
		account
	} from '@/api/my.js'
	import {
		onPageScroll,
		onShow,
		onLoad
	} from "@dcloudio/uni-app";
	import {
		ref
	} from 'vue'
	const list = ref([])
	const typestr = ref('')
	onLoad((opt) => {
		typestr.value = opt.typestr
	})
	onShow(() => {
		init()
	})
	async function init() {
		const res = await account({
			type: 'bank'
		})
		if (res.code == 1) {
			list.value = res.data
			console.log(list.value, 'list.valuelist.valuelist.value');
		}
	}

	function bankopage() {
		uni.navigateTo({
			url: '/pages/my/addzhanghu'
		})
	}

	function gopage(item) {
		if (typestr.value == 'dz') {
			uni.setStorageSync('zhId', item.id)
			uni.navigateBack()
			return
		}
		uni.navigateTo({
			url: '/pages/my/addzhanghu?id=' + item.id
		})

	}
</script>


<style lang="scss">
	.msgicon {
		width: 608rpx;
		margin: 100rpx auto;
		overflow: hidden;

		.msgtext {
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			font-size: 28rpx;
			color: #86909C;
			text-align: center;
			width: 100%;
			margin-top: -30rpx;
		}

		image {
			width: 608rpx;

		}
	}

	.fixed {
		width: 100%;
		overflow: hidden;
		background: #FFFFFF;
		box-shadow: 0rpx -4rpx 8rpx 0rpx rgba(0, 0, 0, 0.03);
		position: fixed;
		bottom: 0%;

		.fixedbtn {
			width: 686rpx;
			height: 82rpx;
			background: linear-gradient(#CD936A 0%, #F5C89D 100%);
			border-radius: 200rpx 200rpx 200rpx 200rpx;
			text-align: center;
			line-height: 82rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: bold;
			font-size: 32rpx;
			color: #FFFFFF;
			margin: auto;
			margin-top: 22rpx;
			margin-bottom: 84rpx;
		}
	}

	page {
		background: #F7F8FA !important;
	}

	.zhgl {
		width: 100%;
		overflow: hidden;
		position: relative;

		.zhglbaqck {
			width: 100%;
			height: 530rpx;
			background: linear-gradient(180deg, #FCE6CD 0%, rgba(252, 230, 205, 0) 100%);
			border-radius: 0rpx 0rpx 0rpx 0rpx;
			position: absolute;
			z-index: -1;
		}

		.zhanghubox {
			width: 686rpx;
			margin: auto;
			overflow: hidden;
			margin-top: 192rpx;

			.itemzh {
				width: 100%;
				height: 198rpx;
				position: relative;
				overflow: hidden;
				background: #FFFFFF;
				border-radius: 20rpx;
				margin-bottom: 28rpx;

				.imageback {
					width: 100%;
					height: 198rpx;
					position: absolute;
					z-index: -1;
				}

				.kahao {
					font-family: PingFang SC, PingFang SC;
					font-weight: bold;
					font-size: 32rpx;
					color: #1D2129;
					margin-top: 28rpx;
					margin-left: 22rpx;
				}

				.yinhanginfo {
					width: 100%;
					display: flex;
					align-items: center;
					margin-top: 32rpx;

					.yhicon {
						width: 76rpx;
						height: 76rpx;
						margin-left: 42rpx;
					}

					.texts {
						margin-left: 22rpx;
						display: flex;
						align-items: center;

						.mobox {
							width: 80rpx;
							height: 34rpx;
							margin-left: 24rpx;
						}

						.t1 {
							font-family: PingFang SC, PingFang SC;
							font-weight: 400;
							font-size: 32rpx;
							color: #000000;
						}

						.t2 {
							font-family: PingFang SC, PingFang SC;
							font-weight: 400;
							font-size: 24rpx;
							color: #4E5969;
						}
					}
				}
			}
		}
	}
</style>